#ifndef __MCUTILS_H_
#define __MCUTILS_H_

#pragma once
#include <vector>
#include <qcolor.h>
#include <MCColor.h>
#include <qpoint.h>
#include <MCPoint2D.h>

namespace MCUtils
{
    template<typename T>
    static bool VectorContains(std::vector<T *> vec, T *item)
    {
        return std::find(vec.begin(), vec.end(), item) != vec.end();
    }

    // not working???
    template<typename T>
    static void RemoveFromVector(std::vector<T *> vec, T *item)
    {
        vec.erase(std::remove(vec.begin(), vec.end(), item), vec.end());
    }

    static QColor toQColor(const MCColor &color)
    {
        return QColor(color.r, color.g, color.b, color.a);
    }

    static MCPoint2D fromQPoint(const QPointF &point)
    {
        return MCPoint2D(point.x(), point.y());
    }

    static QPointF toQPointF(const MCPoint2D &point)
    {
        return QPointF(point.x, point.y);
    }

    static QPoint toQPoint(const MCPoint2D &point)
    {
        return QPoint(point.x, point.y);
    }
};

#endif // !__MCUTILS_H_
